import request from '@utils/request'

// 获取住宿信息列表
export function getAccommodationList (data) {
  return request({
    url: '/accommodation/getPageList',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 获取住宿详情
export function getAccommodationDetail (data) {
  return request({
    url: '/accommodation/getDetail',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 下载住宿信息模板
export function downLoadAccommodation (data) {
  return request({
    url: '/accommodation/downLoadExcel',
    method: 'post',
    data: data,
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 导出住宿信息
export function exportAccommodation (data) {
  return request({
    url: '/accommodation/export',
    method: 'post',
    data: data,
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 导入住宿信息
export function uploadAccommodationIn (data) {
  return request({
    url: '/accommodation/uploadIn',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 导入退宿信息
export function uploadAccommodationOut (data) {
  return request({
    url: '/accommodation/uploadOut',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}